﻿<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="AdminEdit.aspx.cs" Inherits="CNVP.JShop.Web.Admin.AdminEdit" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
            <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta content="IE=7" http-equiv="X-UA-Compatible" />
    <link href="CSS/Edit.css" rel="stylesheet" type="text/css" />
     <script src="../Scripts/jquery.js" type="text/javascript"></script>
    <script src="../Scripts/common.js" type="text/javascript"></script>
    <script src="JS/Admin.js" type="text/javascript"></script>
     <script type="text/javascript">
         if(<%=id %>==0)
         {
             $(function () {
                 $("#btUp").click(function () {
                     var $ddlRoleID=$("#ddlRoleID");
                     if ($ddlRoleID.val() == "0") {
                         alert("请选择所属角色！");
                         $ddlRoleID.focus();
                         return false;
                     }
                     var $txtAdminName = $("#txtAdminName");
                     if ($txtAdminName.val() == "") {
                         alert("请输入管理员账户！");
                         $txtAdminName.focus();
                         return false;
                     }
                     if (IsUserNameExists($txtAdminName.val())) {
                         alert("该管理员账户已存在，请重新填写！");
                          $txtAdminName.focus();
                          return false;
                     }
                     var $txtPwd1 = $("#txtPwd1");
                     if ($txtPwd1.val() == "") {
                         alert("请输入新密码！");
                         $txtPwd1.focus();
                         return false;
                     }
                     var $txtPwd2 = $("#txtPwd2");
                     if ($txtPwd2.val() == "") {
                         alert("请输入确认新密码！");
                         $txtPwd2.focus();
                         return false;
                     }
                     if ($txtPwd1.val() != $txtPwd2.val()) {
                         alert("新密码与确认新密码不相同！");
                         $txtPwd2.focus();
                         return false;
                     }
                 });
             })

             function IsAdminName() {
                 if (IsUserNameExists($("#txtAdminName").val())) {
                     $("#AdminName").html("<font color='#ff0000'>该管理员账户已存在，请重新填写．</font>");
                 }
                 else {
                     $("#AdminName").html("<font color='#00ff00'>管理员账户输入正确．</font>");
                 }
             }
         }
         else
         {
            $(function(){
                $("#btUp").click(function(){
                     var $ddlRoleID=$("#ddlRoleID");
                     if ($ddlRoleID.val() == "0") {
                         alert("请选择所属角色！");
                         $ddlRoleID.focus();
                         return false;
                     }
                     var $txtPwd1 = $("#txtPwd1");
                     var $txtPwd2 = $("#txtPwd2");
                     if ($txtPwd1.val() != $txtPwd2.val()) {
                         alert("新密码与确认新密码不相同！");
                         $txtPwd2.focus();
                         return false;
                     }
                })
            })
         }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div class="Content">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="cell">
                <tr>
                    <td class="cell_group">
                        <img src="Images/ListIconTitle.jpg" alt="" />&nbsp;您的位置：<a href="AdminList.aspx">管理员管理</a><asp:Label ID="lbTitle" runat="server"></asp:Label>
                    </td>
                </tr>
            </table>
                     <table border="0" cellpadding="0" cellspacing="0" class="division">
                        <tr>
                            <th>
                                所属角色:</th>
                            <td>
                                 <asp:DropDownList ID="ddlRoleID" runat="server" Width="160px">
                                    <asp:ListItem Value ="0">--请选择--</asp:ListItem>
                                 </asp:DropDownList>
                                </td>
                        </tr>
                        <tr>
                            <th>
                                管&nbsp;理&nbsp;员:</th>
                            <td>
                                <asp:Label ID="lbtxtAdminName" runat="server"></asp:Label>
                                <asp:TextBox ID="txtAdminName" runat="server" MaxLength="50"/>
                                <div id="AdminName"></div>
                                </td>
                        </tr>
                        <tr id="pwd1" runat="server">
                            <th>
                                密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码:</th>
                            <td>
                                <asp:TextBox ID="txtPwd1" runat="server" TextMode="Password" MaxLength="20" />
                                </td>
                        </tr>
                        <tr id="pwd2" runat="server">
                            <th>
                                确认密码:</th>
                            <td>
                                <asp:TextBox ID="txtPwd2" runat="server" TextMode="Password" MaxLength="20" />
                                </td>
                        </tr>
                        <tr>
                            <th>
                                是否启用:</th>
                            <td >
                               <asp:RadioButtonList ID="rblIsLock" runat="server" RepeatDirection="Horizontal" Width="100px"  CssClass="RadioButtonListTable">
                                    <asp:ListItem Selected="True" Value="0">是</asp:ListItem>
                                    <asp:ListItem Value="1">否</asp:ListItem>
                                </asp:RadioButtonList>
                            </td>
                        </tr>
                        <tr style="display:none;">
                            <th>
                                超级管理员:</th>
                            <td>
                                <asp:RadioButtonList ID="rblIsAdmin" runat="server" RepeatDirection="Horizontal" CssClass="RadioButtonListTable">
                                    <asp:ListItem Value="1">是</asp:ListItem>
                                    <asp:ListItem Selected="True" Value="2">否</asp:ListItem>
                                </asp:RadioButtonList>
                                </td>
                        </tr>
                        <tr>
                            <th>
                                所属部门:</th>
                            <td>
                                 <asp:TextBox ID="txtDepartmentName" runat="server" MaxLength="50"/>
                               </td>
                        </tr>
                        <tr>
                            <th>
                                编&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号:</th>
                            <td>
                                  <asp:TextBox ID="txtAdminNo" runat="server" MaxLength="50"/>
                                </td>
                        </tr>
                          <tr>
                            <th>
                                备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注:</th>
                            <td>
                                <asp:TextBox ID="txtAdminText" runat="server" MaxLength="255" Rows="5" 
                                    TextMode="MultiLine" Width="455px" />
                                </td>
                        </tr>
                        <tr id="LastLoginTime" runat="server">
                            <th>
                                上次登陆时间:</th>
                            <td>
                                <asp:Label ID="lbLastLoginTime" runat="server"></asp:Label>
                                </td>
                        </tr>
                        <tr id="LastLoginIp" runat="server">
                            <th>
                                上次登陆IP:</th>
                            <td>
                                  <asp:Label ID="lbLastLoginIp" runat="server"></asp:Label>
                                </td>
                        </tr>
                        <tr id="LoginNum" runat="server">
                            <th>
                                登陆次数:</th>
                            <td>
                                  <asp:Label ID="lbLoginNum" runat="server"></asp:Label>
                                </td>
                        </tr>
                    </table>
            <div class="EditBtn">  
            <asp:Button ID="btUp" runat="server" Text="提交" OnClick="btUp_Click" />
                                <input type="button" value="取消" onclick="javascript:history.go(-1)" />
                                </div>
    </div>
    </form>
</body>
</html>
